<!--
  ~ Electronic Logistics Management Information System (eLMIS) is a supply chain management system for health commodities in a developing country setting.
  ~
  ~ Copyright (C) 2015  John Snow, Inc (JSI). This program was produced for the U.S. Agency for International Development (USAID). It was prepared under the USAID | DELIVER PROJECT, Task Order 4.
  ~
  ~ This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  ~
  ~ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more details.
  ~
  ~ You should have received a copy of the GNU Affero General Public License along with this program.  If not, see <http://www.gnu.org/licenses/>.
  -->

<div xmlns="http://www.w3.org/1999/html" tab-scroll>

  <h2>
    <span ng-hide="donor.id" openlmis-message="label.donor.add"></span>
    <span ng-show="donor.id" openlmis-message="label.donor.edit"></span>
  </h2>

  <form ng-submit="saveDonor()" id="donorForm" name="donorForm" select2-blur>
    <div class="app-form">
      <div>
        <div class="form-row clearfix">
          <div class="form-cell">
            <div>
              <label for="code">
                <span openlmis-message="label.donor.code"></span>
                <span class="label-required"> *</span>
              </label>
              <div class="form-field">
                <input ng-model="donor.code" name="code" id="code" type="text" maxlength="30" width="200px" ng-required="true" />
                <span class="field-error" ng-show="donorForm.code.$error.required && showError" openlmis-message="missing.value">
                </span>
              </div>
            </div>
            <div>
              <label for="shortName">
                <span openlmis-message="label.donor.short.name"></span>
                <span class="label-required"> *</span>
              </label>
              <div class="form-field">
                <input ng-model="donor.shortName" name="shortName" id="shortName" type="text" maxlength="50" width="320px" ng-required="true" ng-change="validateDonorShortName()" />
                <span class="field-error" ng-show="donorForm.shortName.$error.required && showError" openlmis-message="missing.value">
                </span>
                <span class="field-error" ng-show="donorShortNameInvalid" openlmis-message="label.donor.invalid.name">
                </span>
              </div>
            </div>
            <div>
              <label for="longName">
                <span openlmis-message="label.donor.name"></span>
                <span class="label-required"> *</span>
              </label>
              <div class="form-field">
                <input ng-model="donor.longName" name="longName" id="longName" type="text" maxlength="200" width="320px" ng-required="true" ng-change="validateDonorShortName()" />
                <span class="field-error" ng-show="donorForm.longName.$error.required && showError" openlmis-message="missing.value"> </span>
                <span class="field-error" ng-show="donorShortNameInvalid"> <span openlmis-message="label.donor.invalid.name"></span>
                </span>
              </div>
            </div>
            <div form-toolbar id="action_buttons" class="action-buttons">
              <div class="form-cell button-row">
                <input ng-disabled="donorForm.$invalid" type="submit" class="btn btn-primary save-button" value="Save" />
                <input type="button" class="btn btn-cancel cancel-button" value="Cancel" ng-click="cancelAddEdit()" />
                <input type="button" class="btn btn-danger delete-button" value="Delete" ng-click="showRemoveDonorConfirmDialog()" />
              </div>
              <div class="toolbar-error" id="saveErrorMsgDiv" ng-bind="error" ng-show="error" />
            </div>
          </div>
        </div>
      </div>
    </div>
  </form>
</div>